
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class GameFrame extends JFrame implements WindowListener
{
  private static final int DEFAULT_FPS = 40; 
  GamePanel panel;

  public GameFrame()
  { 
    super("MarioBros");

    // load the background MIDI sequence
    Container c = getContentPane();    // default BorderLayout used
    panel = new GamePanel();

    c.add(panel , "Center");

    addWindowListener( this );
    pack();
    setResizable(false);
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }  // end of BugRunner() constructor


  // ----------------- window listener methods -------------

  public void windowActivated(WindowEvent e) 
  {   }

  public void windowDeactivated(WindowEvent e) 
  {   }


  public void windowDeiconified(WindowEvent e) 
  {   }

  public void windowIconified(WindowEvent e) 
  {  }


  public void windowClosing(WindowEvent e)
  {
	  panel.TurnOffGame();
  }


  public void windowClosed(WindowEvent e) {}
  public void windowOpened(WindowEvent e) {}

  // ----------------------------------------------------
  // Create Frame 
  // ----------------------------------------------------
  public static void main(String args[])
  { 
    new GameFrame();
  }

} // end of BugRunner class
